#tag Window
Begin Window winType_MainWindow
   BackColor       =   16777215
   Backdrop        =   ""
   CloseButton     =   True
   Composite       =   False
   Frame           =   0
   FullScreen      =   False
   HasBackColor    =   False
   Height          =   459
   ImplicitInstance=   True
   LiveResize      =   True
   MacProcID       =   0
   MaxHeight       =   32000
   MaximizeButton  =   True
   MaxWidth        =   32000
   MenuBar         =   852793343
   MenuBarVisible  =   True
   MinHeight       =   64
   MinimizeButton  =   True
   MinWidth        =   64
   Placement       =   0
   Resizeable      =   True
   Title           =   "Release Dates"
   Visible         =   True
   Width           =   350
   Begin EditField EditField1
      AcceptTabs      =   ""
      Alignment       =   0
      AutoDeactivate  =   True
      BackColor       =   16777215
      Bold            =   ""
      Border          =   True
      DataField       =   ""
      DataSource      =   ""
      Enabled         =   True
      Format          =   ""
      Height          =   419
      HelpTag         =   ""
      Index           =   -2147483648
      InitialParent   =   ""
      Italic          =   ""
      Left            =   20
      LimitText       =   0
      LockBottom      =   True
      LockedInPosition=   False
      LockLeft        =   True
      LockRight       =   True
      LockTop         =   True
      Mask            =   ""
      Multiline       =   True
      Password        =   ""
      ReadOnly        =   ""
      Scope           =   0
      ScrollbarHorizontal=   ""
      ScrollbarVertical=   True
      Styled          =   ""
      TabIndex        =   0
      TabPanelIndex   =   0
      TabStop         =   True
      Text            =   ""
      TextColor       =   0
      TextFont        =   "System"
      TextSize        =   0
      TextUnit        =   0
      Top             =   20
      Underline       =   ""
      UseFocusRing    =   True
      Visible         =   True
      Width           =   310
   End
End
#tag EndWindow

#tag WindowCode
	#tag Method, Flags = &h0
		Function nextAppName(d As Date) As String
		  static yr as Integer
		  static vers As Integer
		  
		  if d.Year = yr then
		    vers = vers + 1
		  else
		    yr = d.Year
		    vers = 1
		  end if
		  
		  Return "rb" + format( yr, "0000" ) + "r" + format( vers, "0" )
		End Function
	#tag EndMethod


#tag EndWindowCode

#tag Events EditField1
	#tag Event
		Function ConstructContextualMenu(base as MenuItem, x as Integer, y as Integer) As Boolean
		  dim maxI As integer
		  maxI = EditMenu.Count - 1
		  for i as Integer = 0 to maxI
		    base.Append EditMenu.Item( i )
		  next
		End Function
	#tag EndEvent
	#tag Event
		Sub Open()
		  Dim s As String
		  Dim i, maxI As Integer
		  Dim prevDat As New date
		  Dim thisDat As New date
		  Dim dat() As String = Array( _
		  "2005-06-14", _
		  "2005-08-02", _
		  "2005-09-13", _
		  "2005-10-12", _
		  "2006-01-11", _
		  "2006-04-10", _
		  "2006-07-06", _
		  "2006-10-04", _
		  "2007-01-02", _
		  "2007-04-02", _
		  "2007-06-12", _
		  "2007-09-10", _
		  "2007-11-13", _
		  "2008-02-11", _
		  "2008-05-06", _
		  "2008-07-08", _
		  "2008-09-23", _
		  "2008-12-09", _
		  "2009-03-03", _
		  "2009-04-14", _
		  "2009-07-07", _
		  "2009-09-29", _
		  "2009-12-01", _
		  "2010-02-09" _
		  )
		  
		  maxI = UBound(dat)
		  prevDat.TotalSeconds = 0
		  thisDat.TotalSeconds = 0
		  
		  s = dat(0)
		  prevDat.SQLDate = s
		  me.Text = s + " " + nextAppName( prevDat )
		  For i = 1 To maxI
		    s = dat(i)
		    thisDat.SQLDate = s
		    s =  s + " " + nextAppName( thisDat )
		    me.AppendText _
		    EndOfLine + s + " = " + _
		    CStr( (thisDat.TotalSeconds - prevDat.TotalSeconds) / 86400 ) _
		    + " days"
		    prevDat.TotalSeconds = thisDat.TotalSeconds
		  Next
		  
		  thisDat.Day = thisdat.Day + 90
		  
		  me.AppendText EndOfLine + EndOfLine
		  me.AppendText nextAppName( thisDat ) + " (90 days) due by " + thisDat.SQLDate
		  me.AppendText EndOfLine + thisDat.LongDate
		End Sub
	#tag EndEvent
#tag EndEvents
